<?php
if(!$_COOKIE['userid']){
    echo "<script>location='login.php'</script>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户登录成功首页</title>
</head>
<body>
    <h3>欢迎 <?php echo $_COOKIE['username']?> | <a href="logout.php">退出</a></h3>
</body>
</html>